package com.yeung.exam;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class 三个线程 {
    private static volatile String result;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        result = line;
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        List<Runnable> works = new ArrayList<>();
        Work a = new Work("_A");
        Work b = new Work("_B");
        Work c = new Work("_C");
        executorService.submit(a);
        executorService.submit(b);
        executorService.submit(c);
        executorService.shutdown();
        while (!executorService.isTerminated()) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println(result);

    }

    static class Work implements Runnable {
        private String suf;

        @Override
        public void run() {
            result = result + suf;
        }

        public Work(String suf) {
            this.suf = suf;
        }
    }

}
